# Maintainer: Muflone http://www.muflone.com/contacts/english/

pkgname=dbeaver-plugin-svg-format
pkgver=1.0.135.202302060909
pkgrel=1
pkgdesc='DBeaver plugin to save diagrams in SVG format'
arch=('any')
url='https://dbeaver.io/'
license=('Apache')
makedepends=('unzip')
depends=('dbeaver>=4.2.5' 'dbeaver-plugin-batik')
source=("https://dbeaver.io/update/ce/latest/plugins/org.jkiss.dbeaver.ext.ui.svg_${pkgver}.jar"
        "https://dbeaver.io/update/ce/latest/features/org.jkiss.dbeaver.ext.ui.svg.feature_${pkgver}.jar"
        "${pkgname}.info")
sha256sums=('9ad5dbbb2bee29024bc4a66dc9eb4f4c7e16e6c58cc3205e2f50f63f70d8bc3f'
            'a76deca71f09b58b2319c16d213d9a2a916d79b78befcdcfc367929928289c63'
            '6977b0714a6eb835c15a112ab5de48b4ea6fdb2f0f6408901f2e54dfb40b65f0')
noextract=("org.jkiss.dbeaver.ext.ui.svg_${pkgver}.jar"
           "ui.svg.feature_${pkgver}.jar")

package() {
  # Install plugin
  install -m 755 -d "${pkgdir}/usr/lib/dbeaver/plugins"
  install -m 644 -t "${pkgdir}/usr/lib/dbeaver/plugins" \
    "org.jkiss.dbeaver.ext.ui.svg_${pkgver}.jar"

  # Extract feature
  install -m 755 -d "${pkgdir}/usr/share/dbeaver/features/org.jkiss.dbeaver.ext.ui.svg.feature_${pkgver}"
  unzip -q "${srcdir}/org.jkiss.dbeaver.ext.ui.svg.feature_${pkgver}.jar" \
        -d "${pkgdir}/usr/share/dbeaver/features/org.jkiss.dbeaver.ext.ui.svg.feature_${pkgver}"

  # Add configuration file (handled by the hook)
  install -m 755 -d "${pkgdir}/etc/dbeaver/bundles.d"
  install -m 644 "${srcdir}/${pkgname}.info" "${pkgdir}/etc/dbeaver/bundles.d/20-${pkgname}.info"
}
